package com.wuuxiang.polestar.admin.property;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.wuuxiang.polestar.admin.filter.JwtFilter;

/**
 * Created by lyd on 2017/11/29.
 */
@Configuration
public class FilterConfiguration {
    @Bean
    public FilterRegistrationBean filterDemo4Registration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        //注入过滤器
        registration.setFilter(new JwtFilter());
        //拦截规则
        List<String> urlPatterns = new ArrayList<String>();  
        urlPatterns.add("/polestar/*");  
        registration.setUrlPatterns(urlPatterns);
        /*
        registration.addUrlPatterns("*.do");
        //过滤器名称
        registration.setName("HTTPBearerAuthorizeAttribute");
        //是否自动注册 false
        registration.setEnabled(false);
        //过滤器顺序
        registration.setOrder(1);
        */
        return registration;
    }

}